/*
 * Created on Aug 21, 2010 by Eng. Julian Rousselot
 *  
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package ar.com.visualAORE.controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import ar.com.visualAORE.framework.controller.Controller;
import ar.com.visualAORE.framework.model.Model;
import ar.com.visualAORE.model.Concern;
import ar.com.visualAORE.model.ModelVisualAORE;
import ar.com.visualAORE.view.ColorChooser;

/**
 * @author julian
 *
 */
public class ColorChooserController extends Controller implements ActionListener{	
	private ColorChooser colorChooser;
	public ColorChooserController(ColorChooser colorChooser, Model model) {
		super(null, model);
		this.colorChooser = colorChooser;
	}

	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		Concern concern = new Concern(colorChooser.getPatternName().getText(), null, colorChooser.getTcc().getColor());
		((ModelVisualAORE)getModel()).addConcern(concern);
		colorChooser.dispose();
	}
}
